package com.peng.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.peng.mapper.AdminMapper;
import com.peng.pojo.Admin;
import com.peng.pojo.Permission;
import com.peng.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AdminServiceImpl implements AdminService {
    @Autowired
    private AdminMapper adminMapper;
    @Override
    public Admin findUserByName(String s) {
        LambdaQueryWrapper<Admin> adminLambdaQueryWrapper = new LambdaQueryWrapper<>();
        adminLambdaQueryWrapper.eq(Admin::getUsername,s);
        Admin admin = adminMapper.selectOne(adminLambdaQueryWrapper);
        return admin;
    }

    @Override
    public List<Permission> findPermissionAdminId(Long id) {
        return adminMapper.findPermissionAdminId(id);
    }
}
